package us.gaaoc.framework.dao;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
import org.hibernate.FetchMode;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

import us.gaaoc.framework.model.FilingSearch;
import us.gaaoc.framework.util.HibernateUtil;



/**
 * Home object for domain model class FilingSearch.
 * @see us.gaaoc.framework.model.FilingSearch
 * @author Hibernate Tools
 */
public class FilingSearchDAOHibernate  extends GenericHibernateDAO<FilingSearch, String, FilingSearchDAO>
implements  FilingSearchDAO{

	protected FilingSearchDAOHibernate() {}
	
	Logger LOG = Logger.getLogger(FilingSearchDAOHibernate.class);
	
	@SuppressWarnings("unchecked")
	public List<FilingSearch> search(String fullText) {
		List<FilingSearch> results = new ArrayList<FilingSearch>();
				
		Query query = getSession().createSQLQuery(
					"select search.* from filingSearch search where match(document) against('"
							+ fullText + "')").addEntity("filingSearch",
					FilingSearch.class);
		results= query.list();
		getSession().flush();
		return results; 
	}
}